
import { DataTypes, Sequelize } from 'sequelize'
import { BaseModel, BaseModelAttribute } from './baseModel'
import { ModelUtils } from './modelUtils'
interface UserAttribute extends BaseModelAttribute {
  account: string
  email: string
  name: string
  password: string
}
export class User extends BaseModel<UserAttribute>{
  account: string
  email: string
  name: string
  password: string
}
export class UserInit {
  static init(sequelizeInstance: Sequelize) {
    User.init(ModelUtils.appendPublicFields({
      account: { type: DataTypes.STRING, allowNull: false, comment: '账户' },
      email: { type: DataTypes.STRING, allowNull: false, comment: '邮箱' },
      name: { type: DataTypes.STRING, allowNull: false, comment: '用户名' },
      password: { type: DataTypes.STRING, allowNull: false, comment: '密码' }
    }), ModelUtils.appendTablePublicProperties('user', sequelizeInstance, '用户表'))
  }
}
